package net.wanho.controller;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import net.wanho.service.FileService;
import net.wanho.vo.AjaxResult;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Author：汤小洋
 * Date：2025-09-17 10:14
 * Description：<描述>
 */
@RestController
@RequiredArgsConstructor
public class FileController {

    private final FileService fileService;

    @SneakyThrows
    @PostMapping("/upload")
    public AjaxResult upload(MultipartFile file){
        // System.out.println(file.getOriginalFilename());
        // System.out.println(file.getSize());
        // System.out.println(file.getContentType());
        // System.out.println(file.getInputStream());
        String url = fileService.upload(file);
        return AjaxResult.success("上传成功", url);
    }

}
